<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="com.bci.pwtz.common.util.PwtzUtils"%>
<%@page import="com.bci.pwtz.mysql.model.ResourceType"%>
<%@page import="com.bci.pwtz.admin.service.ResourceTypeService"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ include file="/admin/common.jsp"%>
    <%@page import="com.bci.pwtz.mysql.model.Resource"%>
   <%@page import="com.bci.pwtz.service.ResourceService"%>
    <%
    
       String resid = request.getParameter("resid"); 
	   ResourceService service =(ResourceService)SpringUtil.getBean("resourceService");
	   ResourceTypeService typeservice =(ResourceTypeService)SpringUtil.getBean("resTypeService");
	   Resource res= service.load(Long.valueOf(resid));
	   List<ResourceType> typelist = typeservice.selectRestypeList();
    
    %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<%=basePath %>admin/css/style.css" rel="stylesheet" type="text/css" />
<link href="<%=basePath %>admin/css/llcss.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="<%=basePath %>js/jquery/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="<%=basePath %>admin/js/common.js"></script>
<script type="text/javascript" src="<%=basePath %>js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="<%=basePath %>admin/js/hd_ll.js"></script>
<script type="text/javascript" src="<%=basePath %>admin/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="<%=basePath %>admin/ueditor/ueditor.all.js"></script>
<script type="text/javascript" src="<%=basePath %>admin/web/resource/js/addnews.js"></script>
<script type="text/javascript" src="<%=basePath %>js/ajaxfileupload.js"></script>
 <script type="text/javascript" charset="utf-8" src="<%=basePath %>admin/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
function hide(){
	var selected_value = $(".select_down").val();
	if(selected_value==4 || selected_value >=100){
		$("#downloadurl").attr({"disabled" :"disabled"});
	}
	else{
		$("#downloadurl").attr({"disabled" :false});
	}
	
}
$(function(){
	hide();
});
</script>
<title>修改资源</title>
</head>
<body bgcolor="white">
<%@ include file="/admin/head.jsp"%>
	<!-- main_begin -->
	<div class="pwsj_cont_box">
	<%@ include file="/admin/left.jsp"%>
      <form id="form">
       <input type="hidden" name="resid" value="<%=resid %>" />
     <div class="pwsj_cont_right_box" scroll="no">
      <div class="pwsj_right_byq" scroll="no">
			<div class="pwsj_right_byq_position" style="margin-bottom:3px;">
				<a href="<%=basePath %>admin/web/resource/newslist.jsp" class="position">门户管理</a>&gt;
				<a href="###" class="position">修改资源</a>
				<a class="right" href="<%=basePath%>admin/web/resource/newslist.jsp">返回</a><a class="right" onclick="save()" >保存</a>
			</div>
			<!-- 运行参数_begin -->
			<div class="argument_box">
				<!-- 参数标题-begin -->
				<div class="argument_title">
					<p class="title">消息参数</p>
					<a href="###" class="show"></a>
					<div class="clear"></div>
				</div>				
				<!-- 参数标题-end -->
				<!-- 参数内容_begin -->
				<div class="argument_cont_box">
					<ul class="argument_cont_ul">
						<li class="argument_cont_li"><span>标题：</span><input class="text" type="text" id="resname" name="resname" value="<%=res.getResname()%>"/><em style="color:red;"> *</em></li>
						<li class="argument_cont_li">
							<span>资源类型：</span>
							<select class="select_down" id="restype" name="restype" onchange="hide()">
							<%for (int i = 0; i < typelist.size(); i++) {
								%>
								<option value="<%=typelist.get(i).getTypeId() %>" 
								<%if(typelist.get(i).getTypeId()==res.getRestype()){%>selected="selected"<%} %>><%=typelist.get(i).getTypeName() %></option>
								<%
							} %>
								
							</select>
							<em style="color:red;"> *</em>
						</li>
						<li class="argument_cont_li" style="position:relative;"><span>发布日期：</span>
						<input class="text" type="text" value="<%=PwtzUtils.date2String(res.getPublishtime(), "yyyy-MM-dd")%>" placeholder="请选择日期" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" id ="publishtime" name="publishtime"/>
						<img width="16" height="16" src="../../images/select_date.jpg" style="position:absolute; top:12px;left:230px;" /><em style="color:red;"> *</em></li>
						<div class="clear"></div>
					</ul>
					
					<ul class="argument_cont_ul">
					   
					    <li class="argument_cont_li"><span>下载地址：</span><input class="text" value="<%=res.getDownloadurl()%>" type="text"  id="downloadurl" name="downloadurl"/></li>
					    <li class="argument_cont_li"><span>来源：</span><input class="text" type="text" value="<%=res.getSource()%>" id="source" name="source"/></li>
						<div class="clear"></div>
					</ul>
					<div class="argument_cont_box" style="border-bottom:1px solid #dedede;">
					<!-- 扩展属性左侧_begin -->
					<div class="kzsx_cont_leftbox">
						<div class="add_pic">
							照片:
							<input type="text" id="kzsx_add_pic_text" class="text" placeholder="请选择图片" />
							<input type="button" class="add_pic_btn" value="浏览" onclick="document.getElementById('picfile').click();" />
							<input type="button" class="upload" value="上传" onclick="return uploadPic()">
							<input type="file" id="picfile" name="picfile" style="display: none" />
						</div>
						<!-- 图片动画_begin -->
						<div class="img_flash_box">
							<!-- 图片展示_begin -->
							<div class="center">
								<div class="inner_box" id="inner_box">
									<%-- <div class="img_p">
										<div class="top_div">
											<img class="small_pic" onload="autoSize(this,98)" src="<%=basePath %>user/images/img_device/shebei_1.jpg" alt="" />
										</div>	
										<p>设备文字1</p>
									</div> --%>
									<%if(res.getRescontentlogo()!=null && !"".equals(res.getRescontentlogo())){ %>
									 <div class="img_p">
										<img class="small_pic" src="<%=basePath+"Attachment/ResourcePIC/"+res.getRescontentlogo() %>" alt="" />
										<img class="img_del" onclick="imgdel(this)" src="<%=basePath%>user/images/add_members_close.png" />
									    <input type="hidden" name="rescontentlogo" id="rescontentlogo" value="<%=res.getRescontentlogo()%>">
									</div>
									<% }%>
									<div class="clear" ></div>
								</div>
							</div>
							<!-- 图片展示_begin -->
							<div class="clear"></div><!-- 清除左右浮动 -->
						</div>
						<!-- 图片动画_end -->
					</div>
					<!-- 扩展属性左侧_end -->
					<!-- 扩展右侧 begin -->
                    <div class="kzsx_cont_rightbox" style="width:500px;">
						<div class="add_logo">
							新闻图标:
							<input type="text" id="kzsx_add_logo_text"  class="text" placeholder="请选择图片" />
							<input type="button" class="add_logo_btn" value="浏览" onclick="document.getElementById('logofile').click();" />
							<input type="button" class="upload" value="上传" onclick="return uploadLogo()">
							<input type="file" id="logofile" name="logofile" style="display: none" />
						</div>
						<!-- 图片动画_begin -->
						<div class="img_flash_box">
							<div class="center">
								<div class="inner_box" id="logo_box">
									<%if(res.getReslogo()!=null && !"".equals(res.getReslogo())){ %>
									 <div class="img_p">
										<img class="small_pic" src="<%=basePath+"Attachment/ResourcePIC/"+res.getReslogo() %>" alt="" />
										<img class="img_del" onclick="imgdel(this)" src="<%=basePath%>user/images/add_members_close.png" />
									    <input type="hidden" name="reslogo" id="reslogo" value="<%=res.getReslogo()%>">
									</div>
									<% }%>
								</div>
							</div>
						</div>
					</div>
					<!-- 扩展右侧 end -->
					<div class="clear"></div>
				</div>
					
				</div>
				<ul class="argument_cont_box">
					<span style="font-weight:bold">内容简述：</span>
					<p><textarea class="text"  id="describe" name="describe" maxlength="6000" rows="5" cols="145" style="resize: none;"></textarea></p>
				</ul>
				
				<div id="container" style="margin-bottom: 20px;font-weight: bold;" type="text/plain">
                                                                文章内容：
                                                                
                </div>
				<!-- 参数内容_end -->
			</div>
			<!-- 运行参数_end -->

			
		</div>	
      
      </div>
      
      
      </form>  
    <div class="clear"></div><!-- 清除左右浮动 -->    
   </div>
<%@ include file="/admin/foot.jsp"%>
</body>

<script type="text/javascript">
        var ue = UE.getEditor('container');
        ue.ready(function() {
            //设置编辑器的内容
            ue.setContent('<%=res.getRescontent()%>');
          
        });
        function save(){
        	updateres(ue.getContent());
        }
      
    </script>
</html>